package indi.zhifa.study2024.consigntest.gen.busy.consign.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
import indi.zhifa.core.mpenhance.entity.annotations.ZfDbService;
import indi.zhifa.core.mpenhance.service.impl.ZfDbServiceImpl;
import indi.zhifa.study2024.consigntest.gen.busy.consign.mapper.GenConsignMapper;
import indi.zhifa.study2024.consigntest.gen.busy.consign.po.GenConsignEntity;
import indi.zhifa.study2024.consigntest.gen.busy.consign.service.IGenConsignDbService;

import java.util.List;

/**
 * <p>
 *  服务实现类
 * </p>
 *
 * @author 织法
 * @since 2024-12-11
 */
@ZfDbService(name="GenConsignEntity")
public class GenConsignDbServiceImpl extends ZfDbServiceImpl<GenConsignMapper, GenConsignEntity> implements IGenConsignDbService {

    @Override
    public void clearTest() {
        LambdaUpdateWrapper<GenConsignEntity> updateWrapper = new LambdaUpdateWrapper<GenConsignEntity>()
                .eq(GenConsignEntity::getTestData,true);
        remove(updateWrapper);
    }

    @Override
    public List<GenConsignEntity> findAll(Long pEnpId, Long pTimeKeyBeg, Long pTimeKeyEnd) {

        LambdaQueryWrapper<GenConsignEntity> queryWrapper = new LambdaQueryWrapper<GenConsignEntity>()
                .eq(GenConsignEntity::getEnpId, pEnpId)
                .between(GenConsignEntity::getBillTimeKey,pTimeKeyBeg,pTimeKeyEnd);

        return list(queryWrapper);
    }
}
